Aide-mémoire au sujet des DNS

Commandes valables sous Fedora mais aussi plus généralement sous Linux.

Affiche la configuration DNS actuelle :

$ resolvectl status
Global
         Protocols: LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub
Current DNS Server: 127.0.0.1:5300
       DNS Servers: 127.0.0.1:5300
        DNS Domain: ~test

Link 2 (wlp1s0)
    Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
         Protocols: +DefaultRoute LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.31.1
       DNS Servers: 192.168.31.1

Intéroge directement un serveur DNS :

$ dig @127.0.0.1 -p 5300 server2.vagrant.test +short
192.168.56.21

Résolution d'un hostname avec resolvectl :

$ resolvectl query server2.vagrant.test
server2.vagrant.test: 192.168.56.23

-- Information acquired via protocol DNS in 4.2ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: network

La commande suivante affiche toutes la configuration de resolved.conf :

$ systemd-analyze cat-config systemd/resolved.conf